<!--
 * @author: sanbao
 * @Date: 2023-08-22 19:44:59
-->
<style lang='scss' scoped>
.index {
    background-color: #fff;
    ::v-deep .u-tab-item {
        padding: 0 0.8rem !important;
        padding-right: 1rem !important;
        font-size: 1rem !important;
    }
    .view_box {
        padding: 0 0.8rem;
    }
    .aaaa {
        position: fixed;
        top: 0;
        left: 0;
        background-color: red;
        z-index: 999;
    }
}
</style>

<template>
    <view class='index'>
        <z-paging ref="pagePaging" refresher-only @onRefresh="onRefresh" @scrolltolower="scrolltolower">
            <u-navbar-s></u-navbar-s>
            <!-- 自定义下拉刷新view -S -->
            <template #refresher="{refresherStatus}">
                <customrefresher :status="refresherStatus" :tabs_s="true" />
            </template>
            <!-- 自定义下拉刷新view -E -->
            <!-- 子页面 -S -->
            <view class='aaaa'>
                asdaaasd
            </view>
            <u-custom-tabs type="1" :value="state.value" :animation="true" :defaultTextStyle="{'color':'#000'}" :activeTextStyle="{color:'#000','font-weight':700}" :activeLineStyle="{'background-color':'',height:'0'}" @change="changeIndex">
                <u-custom-pane label="影视短剧" name="1_1">
                    <view1 ref="view1ref"></view1>

                </u-custom-pane>
                <u-custom-pane label="小说推文" name="1_2">内容2</u-custom-pane>
            </u-custom-tabs>

            <!-- 子页面 -E -->
        </z-paging>
    </view>
</template>

<script setup lang='ts'>
import { reactive, ref } from "vue";
import { onLoad, onShow } from "@dcloudio/uni-app";
import { banner, listsAll, searchSketch } from "@/api/index";
import customrefresher from "@/components/custom-refresher/custom-refresher.vue";
import view1 from "@/pages/index/view1";
const pagePaging = ref(null);
const view1ref = ref(null);
const state = reactive<{
    value: number;
}>({
    value: 0,
});
// 下拉刷新
const onRefresh = () => {
    if (state.current == 0) {
        view1ref.value.getData().finally(() => {
            pagePaging.value.endRefresh();
        });
    }
};
// 上拉加载
const scrolltolower = (e) => {
    console.log("e:", e);
};
//  切换tab
const change = (index) => {
    state.current = index;
};
// swiper切换
const animationfinish = (e) => {
    state.current = e.detail.current;
};
const changeIndex = (e) => {
    // console.log("选中:", e);
};
</script>